
/**
 * Created by IntelliJ IDEA.
 * User: jiming
 * Date: 11-4-3
 * Time: 下午1:51
 * To change this template use File | Settings | File Templates.
 */

def libxml = '''
<library>
  <book isbn="1932394842">
    <title>Groovy in Action</title>
    <author>Dierk Koenig</author>
  </book>
  <book isbn="1590597583">
    <title>Definitive Guide to Grails</title>
    <author>Graeme Rocher</author>
  </book>
  <book isbn="0978739299">
    <title>Groovy Recipes</title>
    <author>Scott Davis</author>
  </book>
</library>
'''

def library = new XmlSlurper().parseText(libxml)
def book = library.book.find { it.@isbn == '1932394842' }
println "Title: ${book.title}\nAuthor: ${book.author}"
println groovy.xml.XmlUtil.serialize(book)

def records = new XmlSlurper().parseText(XmlExamples.CAR_RECORDS)


